import request from '@/utils/request'

const apiName = "fdfs";
export default {
  getPageList(roleQuery) {
    return request({
      url: `${apiName}/images/list`,
      method: 'post',
      data: roleQuery
    })
  },
  getById(id) {
    return request({
      url: `${apiName}/images/get/${id}`,
      method: 'get'
    })
  },

  save(image) {
    return request({
      url: `${apiName}/save`,
      method: 'post',
      data: image
    })
  },

  updateById(image) {
    return request({
      url: `${apiName}/images/update`,
      method: 'put',
      data: image
    })
  },
  updateStatus(id, status) {
    let image = {
      id: id,
      status: status
    };
    this.updateById(image)
  },
  removeByPath(path) {
    return request({
      url: `${apiName}/delete?path=${path}`,
      method: 'delete',
    })
  },
  removeRows(paths) {
    return request({
      url: `${apiName}/batch-delete`,
      method: 'delete',
      data: paths
    })
  },
  uploadAvatar(data){
    return request({
      url: `${apiName}/upload`,
      method: 'post',
      data: data
    })
  }
}
